<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" name="" id="" placeholder="验证码">
    <button>点击发送验证码</button>
</body>
<script>
    //获取元素
    let btn = document.querySelector('button');
    //为事件添加监听
    btn.addEventListener('click',function(){
        let time = 60;
        btn.disabled = true;
        let timer = setInterval(function(){
            if(time == 0){
                clearInterval(timer);
                btn.disabled = false;
                btn.innerHTML = '发送验证码';
            }else{
                btn.innerHTML = time + '秒后重新发送';
                time--;
            }
        },1000)
    })
</script>
</html>